import { buildService, openBuildService } from '../../helper/service'

// 值类型为String或Object,String为url(method),Object同axios(config)参数支持相同,data和params只能为对象类型
const settings = {
  saveProject: {//浙里建造v2.1.2-项目保存接口
    url: '/api/v1/project/save_project',
    method: 'post'
  },

  editProject: {//浙里建造v2.1.2-项目编辑接口
    url: '/api/v1/project/edit_project',
    method: 'put'
  },
  getProjectInfo: {//浙里建造v2.1.2-项目详情接口
    url: '/api/v1/project/get_project_info',
    method: 'get'
  },
  // 项目列表
  // getProjectList: {
  //   url: '/api/v1/project/project_list',
  //   method: 'get'
  // },
  //项目列表(新)
  getProjectList: {
    url: '/api/v1/project/get_project_list',
    method: 'get'
  },
  // 添加项目
  createProject: {
    url: '/api/v1/project/create_project',
    method: 'post'
  },
  // 项目详情
  getProjectDetail: {
    url: '/api/v1/project/detail_project',
    method: 'get',
    type: 'restful'
  },
  // 修改项目
  updateProject: {
    url: '/api/v1/project/update_project',
    method: 'put',
    type: 'restful'
  },
  // 删除项目
  deleteProject: {
    url: '/api/v1/project/delete',
    method: 'delete'
  },
  // 获取项目配置信息
  getProjectConfig: {
    url: '/api/v1/project/config',
    method: 'get'
  },
  // 新建项目到第二步关联人员部门时获取项目详情
  getProjectCompanyInfo: {
    url: '/api/v1/project/link_config',
    method: 'get',
    type: 'restful'
  },
  // 根据公司名搜索公司
  searchCompany: {
    url: '/api/v1/project/company_lib',
    method: 'get'
  },
  // 新建项目第二部-关联人员部门
  linkProject: {
    url: '/api/v1/project/link',
    method: 'post',
    type: 'restful'
  },
  // 项目详情-基本信息
  getProjectDetailInfo: {
    url: '/api/v1/project/project',
    method: 'get',
    type: 'restful'
  },
  //项目同步
  projectSync: {
    url: 'api/v1/jt_project/sync_project',
    method: 'get'
  },
  // 建投施工项目列表
  getConstructProjectList: {
    url: '/api/v1/jt_construct/get_project_list',
    method: 'get'
  },
  // 上传项目甘特图
  uploadGantt: {
    url: '/api/v1/project/create_project_gant',
    method: 'post'
  },
  // 获取甘特图数据
  getProjectGantt: {
    url: '/api/v1/project/get_project_gant_detail',
    method: 'get',
    type: 'restful'
  },
  //获取单位下id的所有项目
  getCompanyAllPro: {
    url: 'api/v1/project/project_list_by_company_id',
    method: 'get'
  },
  // 1369工业化项目详情
  projectExtDetail: {
    url: '/api/v1/project/project_ext/detail',
    method: 'get'
  },
  //部门,单位二维码
  getQrcode: {
    url: '/api/v1/user/org_qrcode',
    method: 'post',
    responseType: 'blob'
  },
  // 1369项目同步
  projectExtSync: {
    url: '/api/v1/project/project_ext/sync',
    method: 'get'
  },
  // 1369项目保存
  projectExtSave: {
    url: '/api/v1/project/project_ext/save',
    method: 'post'
  },
  //项目管理-根据项目代码，获取项目信息（显示匹配到的最后一条）
  getIsExistProCode: {
    url: '/api/v1/project/get_project_info_by_project_code',
    method: 'get'
  },
  //项目管理-获取已关联的项目列表
  getRelProList: {
    url: '/api/v1/project/get_project_rela_project_list',
    method: 'get'
  },
  //项目管理-获取已关联的项目列表，例如当前部门是A，查询所有关联A的项目
  getAssoProRelProList: {
    url: '/api/v1/project/get_associated_project_rela_project_list',
    method: 'get'
  },
  //项目管理-根据项目id，关联项目代码相同的项目
  proRelProId: {
    url: '/api/v1/project/project_rela_project_by_project_id',
    method: 'post'
  },
  //取消项目关联
  cancelProRela: {
    url: '/api/v1/project/cancel_project_rela_project',
    method: 'delete'
  },
  //项目管理-根据项目id，获取页面数据授权
  getPageDataAuth: {
    url: '/api/v1/project/get_project_page_object_list_by_project_id',
    method: 'get'
  },
  //项目权限-获取当前用户可查看的项目页面权限列表
  getPageObjListByUser: {
    url: '/api/v1/project/get_page_object_list_by_user',
    method: 'get'
  },
  authProPageObj: {//授权项目页面数据权限
    url: '/api/v1/project/auth_project_page_object',
    method: 'post'
  },
  //检查当前项目是否有权限
  checkCurrentProIsAuth: {
    url: '/api/v1/project/check_project_power',
    method: 'get'
  },
  //获取用户选择的组件
  getUserComponent: {
    url: '/api/v1/user/get_user_component',
    method: 'get'
  },
  //保存用户选择的组件
  saveUserComponent: {
    url: '/api/v1/user/save_user_component',
    method: 'post'
  },
  //解绑
  removeProject: {
    url: '/api/v1/project/unbind',
    method: 'put'
  },
}
const openSetting = {
  // 街道列表
  getStreetList: {
    url: '/api/v1/base/area/get_area_box_list',
    method: 'post'
  },
  //项目列表(浙里建造1.1.8 首页)
  getProjectManageList: {
    url: '/adminc/v1/home_manage/h_module_program/get_data',
    method: 'post'
  },
  //判断登录账号是否是建投单位
  isJianCompany: {
    url: 'ass/api/admin/is_jiantou',
    method: 'get'
  },
  //新增项目成功后生成物料库
  getMaterialStore: {
    url: 'io/web/v1/materiel_library/auto_project_lib',
    method: 'post'
  },
  // 物料收发存同步项目
  syncProject: {
    url: 'ydt/api/j/v1/material/synchronize__project_supplier',
    method: 'get'
  }
}
export default { ...buildService(settings), ...openBuildService(openSetting) }
